$(function(){

$('.move-btn').click(function(){
    var _this = $(this);
    if(_this.attr('data-open') == 'open'){
        closeNav();
    } else{
        openNav();
    }
})
$('.nav-title button').click(function(){
    var _this = $(this);
    if(_this.attr('data-open') == 'open'){
        _this.attr('data-open', 'close');
        $('.sub-nav').removeClass('open');
    } else{
        _this.attr('data-open', 'open');
        $('.sub-nav').addClass('open');
    }
})

function closeNav(){
    $('.move-btn').attr('data-open', 'close');
    $('.move-btn').find('.mark').removeClass('show');
    $('.nav-box').removeClass('open');
    $('.nav-title').attr('data-open', 'close');
    $('.sub-nav').removeClass('open');
}
function openNav(){
    $('.move-btn').attr('data-open', 'open');
    $('.move-btn').find('.mark').addClass('show');
    $('.nav-box').addClass('open');
}
$(window).scroll(function(){
    if($('.move-btn').attr('data-open') == 'open'){
        closeNav();
    } 
})

})